package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author 苏成博
 * @date 2023-02-11 15:57
 */
@Mapper
public interface UserMapper {
    @Select("select * from user where openid=#{openid}")
    User getByOpenid(String openid);

    void saveUser(User user);
    @Select("select * from user where id=#{id}")
    User getById(Long id);
    @Select("select count(id) from user where create_time < #{localDate}")
    Integer findTotalUser(LocalDateTime localDate);
    @Select("select count(id) from user where create_time between #{creatTimeMin} and #{creatTimeMax}")
    Integer findNewUser(LocalDateTime creatTimeMin, LocalDateTime creatTimeMax);
}
